/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
const path = require('path');
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = (exports = {});

  config.cluster = {
    listen: {
      path: '',
      port: 7001,// 这里就是你要修改的端口号
      hostname: 'localhost', // 0.0.0.0
    }
  }
  config.logger = {
    level: 'INFO',
    dir: path.join(__dirname, '../logs/prod/app'), // 保存路径为工程路径下`logs/prod/app`
  };
  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1678498940455_3878';

  // add your middleware config here
  config.middleware = [];
  // 关闭csrf
  config.security = {
    csrf: {
      enable: false,
    },
    domainWhiteList: ['http://localhost:8080'],
  };

  config.jwt = {
    enable: true,
    secret: '123' || '',
    match: ['v2/works'],
  };

  config.multipart = {
    mode: 'file',
    whitelist: ['.png', '.jpg', '.jpeg', '.mp4', '.gif', '.webp'],
    // fileSize: '1mb',
  };

  config.cors = {
    origin: '*',
    allowMethods: 'GET, HEAD, PUT, POST, DELETE, PATCH',
    credentials: true,
  };

  config.oss = {
    // 这里需要的东西去自己的服务器里看，我用的阿里云
    client: {
      accessKeyId: 'LTAI5tLEv3ecjSJgHm6zPZ6g',
      accessKeySecret: 'SAYmZaUszGgtHRWDq1Sv9BPRlUfivZ',
      bucket: 'wd-lt',
      // oss-cn-beijing.aliyuncs.com
      endpoint: 'oss-cn-shanghai.aliyuncs.com',
      timeout: '60s',
    },
  };

  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
    mysql: {
      // 单数据库信息配置
      client: {
        // host
        host: 'localhost',
        // 端口号
        port: '3306',
        // 用户名
        user: 'root',
        // 密码
        // password: 'guilai123456',
        password: 'root',
        // 数据库名
        database: 's_all_poster',
      },
      // 是否加载到 app 上，默认开启
      app: true,
      // 是否加载到 agent 上，默认关闭
      agent: false,
    },
  };

  return {
    ...config,
    ...userConfig,
  };
};
